package com.view.main;

import java.util.ArrayList;
import java.util.List;

import javax.swing.JCheckBox;
import javax.swing.JPanel;

/**
 * @version v1.0
 * 
 */
public class CheckBoxPanel extends JPanel {
	private static final long serialVersionUID = -6890744052614355568L;
	private JCheckBox ibatis,java,dao,service,action, jsp,spring, struts,doc,xUtils;
	public static final String IBATIS = "ibatis";
	public static final String JAVA = "java";
	public static final String DOC = "doc";
	public static final String DAO = "dao";
	public static final String XUTILS = "xUtils";
	public static final String ACTION = "action";
	public static final String SERVICE = "service";
	public static final String SPRING = "spring";
	public static final String STRUTS = "struts";
	public static final String JAVAEXAMPLE = "javaExample";
	public static final String JSP = "jsp";
	private List<String> list;
	JCheckBox[] checkBoxPanels;

	public CheckBoxPanel() {
		super();
		list = new ArrayList<String>();

		ibatis = new JCheckBox(IBATIS,null,true);
		java = new JCheckBox(JAVA,null,true);
		dao = new JCheckBox(DAO,null,true);
		service = new JCheckBox(SERVICE,null,true);
		action = new JCheckBox(ACTION,null,true);

		jsp = new JCheckBox(JSP);
		doc = new JCheckBox(DOC);
		xUtils = new JCheckBox(XUTILS);
		spring = new JCheckBox(SPRING);
		struts = new JCheckBox(STRUTS);

		checkBoxPanels = new JCheckBox[] { ibatis,java,dao,service,action, jsp,doc,spring, struts,xUtils};
		for (int i = 0; i < checkBoxPanels.length; i++) {
			this.add(checkBoxPanels[i]);
		}
	}

	public List<String> getCheckList() {
		list.clear();
		for (int i = 0; i < checkBoxPanels.length; i++) {
			if (checkBoxPanels[i].isSelected()) {
				list.add(checkBoxPanels[i].getText());
			}
		}
		return list;
	}

}
